package ipfms.model;

import java.io.Serializable;
import java.util.Date;

import java.util.List;
import javax.persistence.*;

@Entity
@Table(name = "user")
public class Pengguna implements Serializable {

    @Id
    @Column(name = "user_id", length = 30)
    private String idPengguna;
    @Column(name = "name", length = 50, nullable = false)
    private String nama;
    @Column(name = "last_login")
//    @Temporal(TemporalType.DATE)
    private Date tarikhAkhirLogin;
    @Column(name = "password", length = 100)
    private String password;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_type")
    private KodJenisPengguna kodJenisPengguna;
    
    @OneToMany (mappedBy = "pengguna")
    private List<PenggunaPeranan> senaraiPeranan;
    
    
	@Embedded
    private InfoAudit infoAufit;
        
    @Column(name = "email")
    private String email;
    @Column(name = "phone")
    private String phone;
    @Column(name = "add1")
    private String add1;
    @Column(name = "add2")
    private String add2;
    @Column(name = "add3")
    private String add3;
    @Column(name = "add4")
    private String add4;
    @Column(name = "poscode")
    private String poscode;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "state")
    private KodNegeri state;
    @Basic(optional = false)
    @Column(name = "active")
    private char active;

    public InfoAudit getInfoAufit() {
        return infoAufit;
    }

    public void setInfoAufit(InfoAudit infoAufit) {
        this.infoAufit = infoAufit;
    }
  
    
    public void setIdPengguna(String idPengguna) {
        this.idPengguna = idPengguna;
    }

    public String getIdPengguna() {
        return idPengguna;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    public String getNama() {
        return nama;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getTarikhAkhirLogin() {
        return tarikhAkhirLogin;
    }

    public void setTarikhAkhirLogin(Date lastLoginDate) {
        this.tarikhAkhirLogin = lastLoginDate;
    }

//	public void setInfoAudit(InfoAudit infoAufit) {
//        this.infoAufit = infoAufit;
//    }
//   
//
//    public InfoAudit getInfoAudit() {
//        return infoAufit;
//    }
    public List<PenggunaPeranan> getSenaraiPeranan() {
        return senaraiPeranan;
    }

    public void setSenaraiPeranan(List<PenggunaPeranan> senaraiPeranan) {
        this.senaraiPeranan = senaraiPeranan;
    }
        

    public KodJenisPengguna getKodJenisPengguna() {
        return kodJenisPengguna;
    }

    public void setKodJenisPengguna(KodJenisPengguna kodJenisPengguna) {
        this.kodJenisPengguna = kodJenisPengguna;
    }

    public String getAdd1() {
        return add1;
    }

    public void setAdd1(String add1) {
        this.add1 = add1;
    }

    public String getAdd2() {
        return add2;
    }

    public void setAdd2(String add2) {
        this.add2 = add2;
    }

    public String getAdd3() {
        return add3;
    }

    public void setAdd3(String add3) {
        this.add3 = add3;
    }

    public String getAdd4() {
        return add4;
    }

    public void setAdd4(String add4) {
        this.add4 = add4;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPoscode() {
        return poscode;
    }

    public void setPoscode(String poscode) {
        this.poscode = poscode;
    }

    public KodNegeri getState() {
        return state;
    }

    public void setState(KodNegeri state) {
        this.state = state;
    }

    public char getActive() {
        return active;
    }

    public void setActive(char active) {
        this.active = active;
    }

 
}
